package com.ruoyi.web.controller.tongban;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tongban.domain.FaceConfig;
import com.ruoyi.tongban.service.IFaceConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 参数配置Controller
 * 
 * @author ruoyi
 * @date 2021-04-08
 */
@RestController
@RequestMapping("/tongban/faceconfig")
public class FaceConfigController extends BaseController
{
    @Autowired
    private IFaceConfigService faceConfigService;

    /**
     * 查询参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(FaceConfig faceConfig)
    {
        startPage();
        List<FaceConfig> list = faceConfigService.selectFaceConfigList(faceConfig);
        return getDataTable(list);
    }

    /**
     * 导出参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:export')")
    @Log(title = "参数配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FaceConfig faceConfig)
    {
        List<FaceConfig> list = faceConfigService.selectFaceConfigList(faceConfig);
        ExcelUtil<FaceConfig> util = new ExcelUtil<FaceConfig>(FaceConfig.class);
        return util.exportExcel(list, "faceconfig");
    }

    /**
     * 获取参数配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:query')")
    @GetMapping(value = "/{configId}")
    public AjaxResult getInfo(@PathVariable("configId") Integer configId)
    {
        return AjaxResult.success(faceConfigService.selectFaceConfigById(configId));
    }

    /**
     * 新增参数配置
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:add')")
    @Log(title = "参数配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FaceConfig faceConfig)
    {
        return toAjax(faceConfigService.insertFaceConfig(faceConfig));
    }

    /**
     * 修改参数配置
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:edit')")
    @Log(title = "参数配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FaceConfig faceConfig)
    {
        return toAjax(faceConfigService.updateFaceConfig(faceConfig));
    }

    /**
     * 删除参数配置
     */
    @PreAuthorize("@ss.hasPermi('tongban:faceconfig:remove')")
    @Log(title = "参数配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{configIds}")
    public AjaxResult remove(@PathVariable Integer[] configIds)
    {
        return toAjax(faceConfigService.deleteFaceConfigByIds(configIds));
    }
}
